unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, Grids, DBGrids, ComCtrls, ToolWin;

type
  TForm1 = class(TForm)
    ADOConnection1: TADOConnection;
    dbgrd1: TDBGrid;
    ds1: TDataSource;
    qry1: TADOQuery;
    tlb1: TToolBar;
    btn1: TToolButton;
    btn2: TToolButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
var
  SQLA:string;
begin
  //ADOConnection1.ConnectionString:='Provider=Microsoft.ACE.OLEDB.12.0;Password="";Data Source=C:\aa.xlsx;Extended Properties=''Excel 12.0;IMEX=1;HDR=YES'';Persist Security Info=True;';
  //ADOConnection1.ConnectionString:='Provider=Microsoft.Ace.OLEDB.12.0; Data Source=C:\aa.xlsx;Extended Properties=''Excel 12.0; HDR=Yes''';
  //ADOConnection1.ConnectionString:='Provider=Microsoft.Ace.OLEDB.12.0;Data Source=C:\aa.xlsx;Extended Properties=''Excel 12.0; HDR=Yes''';
  //ADOConnection1.ConnectionString:='Provider=Microsoft.ACE.OLEDB.12.0;Password="";Data Source=C:\aa.xlsx;Extended Properties=''Excel 12.0;IMEX=1;HDR=YES'';Persist Security Info=True;';
  //ADOConnection1.ConnectionString := 'Provider=Microsoft.Ace.OleDb.12.0; Data Source=C:\aa.xlsx;Extended Properties=''Excel 12.0; HDR=Yes''';
  //ADOConnection1.Connected:=True;

  //SQLA:='Provider=Microsoft.ACE.OLEDB.12.0;Data Source=%s;Extended Properties= Excel 12.0;Persist Security Info=True';
  //SQLA:=Format(SQLA,['C:\aa.xlsx']);
  //ADOConnection1.ConnectionString:=SQLA;

  //it works
  //C:\aa.xlsx;Extended Properties= Excel 12.0;Persist Security Info=True
  
  qry1.Open;


end;

end.
